package com.productssite.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * Attribute entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "attribute", catalog = "productssalessite")
public class Attribute implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer idAttribute;
	private RefAttribute refattribute;
	private Product product;
	private String attributeValue;

	// Constructors

	/** default constructor */
	public Attribute() {
	}

	/** minimal constructor */
	public Attribute(Integer idAttribute, RefAttribute refattribute,
			Product product) {
		this.idAttribute = idAttribute;
		this.refattribute = refattribute;
		this.product = product;
	}

	/** full constructor */
	public Attribute(Integer idAttribute, RefAttribute refattribute,
			Product product, String attributeValue) {
		this.idAttribute = idAttribute;
		this.refattribute = refattribute;
		this.product = product;
		this.attributeValue = attributeValue;
	}

	// Property accessors
	@Id
	@GeneratedValue (strategy=GenerationType.IDENTITY)
	@Column(name = "idAttribute", unique = true, nullable = false)
	public Integer getIdAttribute() {
		return this.idAttribute;
	}

	public void setIdAttribute(Integer idAttribute) {
		this.idAttribute = idAttribute;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idRef", nullable = false)
	public RefAttribute getRefattribute() {
		return this.refattribute;
	}

	public void setRefattribute(RefAttribute refattribute) {
		this.refattribute = refattribute;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idProduct", nullable = false)
	public Product getProduct() {
		return this.product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	@Column(name = "attributeValue", length = 254)
	public String getAttributeValue() {
		return this.attributeValue;
	}

	public void setAttributeValue(String attributeValue) {
		this.attributeValue = attributeValue;
	}

}